home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / full / jbuild / setup / JBuilder / jsamples.z / molecule.jar / sunw / demo / molecule / Matrix3D.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-04  |  3.7 KB  |  209 lines

  1. package sunw.demo.molecule;
  2.  
  3. class Matrix3D {
  4.    // $FF: renamed from: xx float
  5.    float field_0 = 1.0F;
  6.    // $FF: renamed from: xy float
  7.    float field_1;
  8.    // $FF: renamed from: xz float
  9.    float field_2;
  10.    // $FF: renamed from: xo float
  11.    float field_3;
  12.    // $FF: renamed from: yx float
  13.    float field_4;
  14.    // $FF: renamed from: yy float
  15.    float field_5 = 1.0F;
  16.    // $FF: renamed from: yz float
  17.    float field_6;
  18.    // $FF: renamed from: yo float
  19.    float field_7;
  20.    // $FF: renamed from: zx float
  21.    float field_8;
  22.    // $FF: renamed from: zy float
  23.    float field_9;
  24.    // $FF: renamed from: zz float
  25.    float field_10 = 1.0F;
  26.    // $FF: renamed from: zo float
  27.    float field_11;
  28.    // $FF: renamed from: pi double
  29.    static final double field_12 = 3.14159265;
  30.  
  31.    void scale(float var1) {
  32.       this.field_0 *= var1;
  33.       this.field_1 *= var1;
  34.       this.field_2 *= var1;
  35.       this.field_3 *= var1;
  36.       this.field_4 *= var1;
  37.       this.field_5 *= var1;
  38.       this.field_6 *= var1;
  39.       this.field_7 *= var1;
  40.       this.field_8 *= var1;
  41.       this.field_9 *= var1;
  42.       this.field_10 *= var1;
  43.       this.field_11 *= var1;
  44.    }
  45.  
  46.    void scale(float var1, float var2, float var3) {
  47.       this.field_0 *= var1;
  48.       this.field_1 *= var1;
  49.       this.field_2 *= var1;
  50.       this.field_3 *= var1;
  51.       this.field_4 *= var2;
  52.       this.field_5 *= var2;
  53.       this.field_6 *= var2;
  54.       this.field_7 *= var2;
  55.       this.field_8 *= var3;
  56.       this.field_9 *= var3;
  57.       this.field_10 *= var3;
  58.       this.field_11 *= var3;
  59.    }
  60.  
  61.    void translate(float var1, float var2, float var3) {
  62.       this.field_3 += var1;
  63.       this.field_7 += var2;
  64.       this.field_11 += var3;
  65.    }
  66.  
  67.    void yrot(double var1) {
  68.       var1 *= 0.017453292500000002;
  69.       double var3 = Math.cos(var1);
  70.       double var5 = Math.sin(var1);
  71.       float var7 = (float)((double)this.field_0 * var3 + (double)this.field_8 * var5);
  72.       float var8 = (float)((double)this.field_1 * var3 + (double)this.field_9 * var5);
  73.       float var9 = (float)((double)this.field_2 * var3 + (double)this.field_10 * var5);
  74.       float var10 = (float)((double)this.field_3 * var3 + (double)this.field_11 * var5);
  75.       float var11 = (float)((double)this.field_8 * var3 - (double)this.field_0 * var5);
  76.       float var12 = (float)((double)this.field_9 * var3 - (double)this.field_1 * var5);
  77.       float var13 = (float)((double)this.field_10 * var3 - (double)this.field_2 * var5);
  78.       float var14 = (float)((double)this.field_11 * var3 - (double)this.field_3 * var5);
  79.       this.field_3 = var10;
  80.       this.field_0 = var7;
  81.       this.field_1 = var8;
  82.       this.field_2 = var9;
  83.       this.field_11 = var14;
  84.       this.field_8 = var11;
  85.       this.field_9 = var12;
  86.       this.field_10 = var13;
  87.    }
  88.  
  89.    void xrot(double var1) {
  90.       var1 *= 0.017453292500000002;
  91.       double var3 = Math.cos(var1);
  92.       double var5 = Math.sin(var1);
  93.       float var7 = (float)((double)this.field_4 * var3 + (double)this.field_8 * var5);
  94.       float var8 = (float)((double)this.field_5 * var3 + (double)this.field_9 * var5);
  95.       float var9 = (float)((double)this.field_6 * var3 + (double)this.field_10 * var5);
  96.       float var10 = (float)((double)this.field_7 * var3 + (double)this.field_11 * var5);
  97.       float var11 = (float)((double)this.field_8 * var3 - (double)this.field_4 * var5);
  98.       float var12 = (float)((double)this.field_9 * var3 - (double)this.field_5 * var5);
  99.       float var13 = (float)((double)this.field_10 * var3 - (double)this.field_6 * var5);
  100.       float var14 = (float)((double)this.field_11 * var3 - (double)this.field_7 * var5);
  101.       this.field_7 = var10;
  102.       this.field_4 = var7;
  103.       this.field_5 = var8;
  104.       this.field_6 = var9;
  105.       this.field_11 = var14;
  106.       this.field_8 = var11;
  107.       this.field_9 = var12;
  108.       this.field_10 = var13;
  109.    }
  110.  
  111.    void zrot(double var1) {
  112.       var1 *= 0.017453292500000002;
  113.       double var3 = Math.cos(var1);
  114.       double var5 = Math.sin(var1);
  115.       float var7 = (float)((double)this.field_4 * var3 + (double)this.field_0 * var5);
  116.       float var8 = (float)((double)this.field_5 * var3 + (double)this.field_1 * var5);
  117.       float var9 = (float)((double)this.field_6 * var3 + (double)this.field_2 * var5);
  118.       float var10 = (float)((double)this.field_7 * var3 + (double)this.field_3 * var5);
  119.       float var11 = (float)((double)this.field_0 * var3 - (double)this.field_4 * var5);
  120.       float var12 = (float)((double)this.field_1 * var3 - (double)this.field_5 * var5);
  121.       float var13 = (float)((double)this.field_2 * var3 - (double)this.field_6 * var5);
  122.       float var14 = (float)((double)this.field_3 * var3 - (double)this.field_7 * var5);
  123.       this.field_7 = var10;
  124.       this.field_4 = var7;
  125.       this.field_5 = var8;
  126.       this.field_6 = var9;
  127.       this.field_3 = var14;
  128.       this.field_0 = var11;
  129.       this.field_1 = var12;
  130.       this.field_2 = var13;
  131.    }
  132.  
  133.    void mult(Matrix3D var1) {
  134.       float var2 = this.field_0 * var1.field_0 + this.field_4 * var1.field_1 + this.field_8 * var1.field_2;
  135.       float var3 = this.field_1 * var1.field_0 + this.field_5 * var1.field_1 + this.field_9 * var1.field_2;
  136.       float var4 = this.field_2 * var1.field_0 + this.field_6 * var1.field_1 + this.field_10 * var1.field_2;
  137.       float var5 = this.field_3 * var1.field_0 + this.field_7 * var1.field_1 + this.field_11 * var1.field_2 + var1.field_3;
  138.       float var6 = this.field_0 * var1.field_4 + this.field_4 * var1.field_5 + this.field_8 * var1.field_6;
  139.       float var7 = this.field_1 * var1.field_4 + this.field_5 * var1.field_5 + this.field_9 * var1.field_6;
  140.       float var8 = this.field_2 * var1.field_4 + this.field_6 * var1.field_5 + this.field_10 * var1.field_6;
  141.       float var9 = this.field_3 * var1.field_4 + this.field_7 * var1.field_5 + this.field_11 * var1.field_6 + var1.field_7;
  142.       float var10 = this.field_0 * var1.field_8 + this.field_4 * var1.field_9 + this.field_8 * var1.field_10;
  143.       float var11 = this.field_1 * var1.field_8 + this.field_5 * var1.field_9 + this.field_9 * var1.field_10;
  144.       float var12 = this.field_2 * var1.field_8 + this.field_6 * var1.field_9 + this.field_10 * var1.field_10;
  145.       float var13 = this.field_3 * var1.field_8 + this.field_7 * var1.field_9 + this.field_11 * var1.field_10 + var1.field_11;
  146.       this.field_0 = var2;
  147.       this.field_1 = var3;
  148.       this.field_2 = var4;
  149.       this.field_3 = var5;
  150.       this.field_4 = var6;
  151.       this.field_5 = var7;
  152.       this.field_6 = var8;
  153.       this.field_7 = var9;
  154.       this.field_8 = var10;
  155.       this.field_9 = var11;
  156.       this.field_10 = var12;
  157.       this.field_11 = var13;
  158.    }
  159.  
  160.    void unit() {
  161.       this.field_3 = 0.0F;
  162.       this.field_0 = 1.0F;
  163.       this.field_1 = 0.0F;
  164.       this.field_2 = 0.0F;
  165.       this.field_7 = 0.0F;
  166.       this.field_4 = 0.0F;
  167.       this.field_5 = 1.0F;
  168.       this.field_6 = 0.0F;
  169.       this.field_11 = 0.0F;
  170.       this.field_8 = 0.0F;
  171.       this.field_9 = 0.0F;
  172.       this.field_10 = 1.0F;
  173.    }
  174.  
  175.    void transform(float[] var1, int[] var2, int var3) {
  176.       float var4 = this.field_0;
  177.       float var5 = this.field_1;
  178.       float var6 = this.field_2;
  179.       float var7 = this.field_3;
  180.       float var8 = this.field_4;
  181.       float var9 = this.field_5;
  182.       float var10 = this.field_6;
  183.       float var11 = this.field_7;
  184.       float var12 = this.field_8;
  185.       float var13 = this.field_9;
  186.       float var14 = this.field_10;
  187.       float var15 = this.field_11;
  188.       int var16 = var3 * 3;
  189.  
  190.       while(true) {
  191.          var16 -= 3;
  192.          if (var16 < 0) {
  193.             return;
  194.          }
  195.  
  196.          float var17 = var1[var16];
  197.          float var18 = var1[var16 + 1];
  198.          float var19 = var1[var16 + 2];
  199.          var2[var16] = (int)(var17 * var4 + var18 * var5 + var19 * var6 + var7);
  200.          var2[var16 + 1] = (int)(var17 * var8 + var18 * var9 + var19 * var10 + var11);
  201.          var2[var16 + 2] = (int)(var17 * var12 + var18 * var13 + var19 * var14 + var15);
  202.       }
  203.    }
  204.  
  205.    public String toString() {
  206.       return "[" + this.field_3 + "," + this.field_0 + "," + this.field_1 + "," + this.field_2 + ";" + this.field_7 + "," + this.field_4 + "," + this.field_5 + "," + this.field_6 + ";" + this.field_11 + "," + this.field_8 + "," + this.field_9 + "," + this.field_10 + "]";
  207.    }
  208. }
  209.